package com.diankangwo.controller;

import com.diankangwo.constant.resultMsg;
import com.diankangwo.dao.GlobalFieldDAO;
import com.diankangwo.domain.GlobalField;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 全球购场馆
 * @author xiaoyu
 *
 */
@Controller
@Api(description = "全球购场馆")
public class GlobalFieldController {

    @Autowired
    private GlobalFieldDAO globalFieldDAO;

    /**
     * 加载全球购场馆列表
     *
     * @return
     * */
    @ApiOperation(value = "加载全球购场馆列表", notes = "")
    @ResponseBody
    @RequestMapping(value = "/globalField/list", method = RequestMethod.POST)
    public String list() {
        String code = "2";
        String msg = "操作异常！";
        List<GlobalField> gf =  globalFieldDAO.findAll();
        if(gf != null){
            code = "1";
            msg = "查询成功！";
        }else{
            code = "1";
            msg = "未查询到数据！";
        }
        return resultMsg.mapToJson(code, msg, gf);
    }
}
